package com.marry.multidatasource.service;

import com.github.pagehelper.PageHelper;
import com.marry.multidatasource.mapper.fg.ZownerMapper;
import com.marry.multidatasource.model.RequestItem;
import com.marry.multidatasource.model.fg.RoomRight;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ml
 * @create 2018-01-10--15:36
 */
@Service
public class ZownerService {

    @Autowired
    private ZownerMapper zownerMapper;

    private static final Integer pagesize=5;
    public List<RoomRight> getRoomListByName(RequestItem requestItem){

        PageHelper.startPage(requestItem.getPage(),pagesize);
        return zownerMapper.selectRoomListByName(requestItem);
    }


    public List<RoomRight> getRoomListByLocationOrCqzh(RequestItem requestItem) {
        PageHelper.startPage(requestItem.getPage(),pagesize);
        return zownerMapper.selectRoomListByLcCn(requestItem);
    }

    public List<RoomRight> getRoomsByCertno(RequestItem requestItem) {
        PageHelper.startPage(requestItem.getPage(),pagesize);
        return zownerMapper.selectRoomsByCertno(requestItem);
    }
}
